<template>
  <view>
    <view class="contentDiv">
      <view class="content">
        <text>营业执照</text>
        <view class="choice_btn_font complete" v-if="applyInfo.bizLicense && applyInfo.bizLicenseStatus == 1">已完善</view>
        <view class="choice_btn_font" v-else @click="goToPage('/pages/cashWithDrawal/complete?type=1&qfId=' + applyInfo.qfId + '&staus=' + applyInfo.bizLicenseStatus + '&url=' + applyInfo.bizLicense)">
          {{!applyInfo.bizLicense ? '去上传' : applyInfo.bizLicenseStatus == 0 ? '审核中' : applyInfo.bizLicenseStatus == 2 ? '审核失败，重新上传' : applyInfo.bizLicenseStatus == 3 ? '审核驳回，重新上传' : '未完善'}}
        </view>
        <view class="arrow"></view>
      </view>
    </view>
    <!-- <view class="contentDiv" v-if="applyInfo.tfProxyStatus != 1">
      <view class="content">
        <text>委托个人打款协议</text>
        <view class="choice_btn_font complete" v-if="(applyInfo.tfProxyFile && applyInfo.tfProxyStatus == 2 && applyInfo.tfStatus == 1) || applyInfo.tfProxyStatus == 1">已完善</view>
        <view class="choice_btn_font" v-else @click="goToPage('/pages/cashWithDrawal/complete?type=2&tfId=' + applyInfo.tfId + '&url=' + applyInfo.tfProxyFile)">
          {{!applyInfo.tfProxyFile ? '去上传' : applyInfo.tfProxyStatus == 0 && applyInfo.tfStatus == 0 ? '审核中' : applyInfo.tfProxyStatus == 0 && applyInfo.tfStatus == 2 ? '文件核失败，请重新上传' : applyInfo.tfProxyStatus == 0 && applyInfo.tfStatus == 3 ? '文件被驳回，请重新上传' : applyInfo.tfProxyStatus == 3 ? '文件无效，请重新上传' : '未完善'}}
        </view>
        <view class="arrow"></view>
      </view>
    </view> -->
    <block v-if="applyInfo.ctId">
      <view class="contentDiv" v-if="applyInfo.ctProxyStatus != 1">
        <view class="content">
          <text>介绍信</text>
          <view class="choice_btn_font complete" v-if="applyInfo.ctProxyStatus == 2 && applyInfo.ctProxyFile">已完善</view>
          <view class="choice_btn_font" v-else @click="goToPage('/pages/cashWithDrawal/complete?type=3&ctId=' + applyInfo.ctId  + '&url=' + applyInfo.ctProxyFile)">
            {{!applyInfo.ctProxyFile ? '去上传' : applyInfo.ctProxyStatus == 0 ? '审核中' : applyInfo.ctProxyStatus == 3 ? '文件无效，请重新上传' : '未完善'}}
          </view>
          <view class="arrow"></view>
        </view>
      </view>
      <view class="contentDiv">
        <view class="content clearLine">
          <text>合同</text>
          <view class="choice_btn_font complete" v-if="applyInfo.ctStatus == 1 && applyInfo.ctAuditStatus == 1">已完善</view>
          <view class="choice_btn_font" v-else>
            {{applyInfo.ctStatus == 0 ? '请提供合同' : applyInfo.ctAuditStatus == 0 ? '审核中' : applyInfo.ctAuditStatus == '2' ? '文件被驳回，请重新提供': '未完善'}}
          </view>
          <!-- <view class="arrow"></view> -->
        </view>
      </view>
    </block>
    <view class="tips">
      <text>完善以上信息就可提现</text>
    </view>
  </view>
</template>

<script>
import { getWithdrawInfoApi, withdrawApi, getUserUpgradeApplyApi } from '@/service/withdraw/withdraw.service.js'
export default {
  data () {
    return {
      applyInfo: {
        qfId: null, // 资质记录ID
        qfStatus: null, // 资质记录状态
        bizLicense: null, // 营业执照，null表示无，需要补充资质
        bizLicenseStatus: null, // 营业执照状态：0-待审核，1-审核通过，2-审核失败，3-审核驳回
        tfId: null, // 打款记录id
        tfStatus: null, // 打款记录审核状态：0-待审核，1-审核通过，2-审核失败，3-审核驳回
        tfProxyStatus: null, // 委托个人打款协议状态：0-需要，1-不需要，2-有效，3-无效
        tfProxyFile: null, // 委托个人打款协议id，null表示没有上传
        ctId: null, // 合同记录id
        ctStatus: null, // 合同接收状态：0-未收到，1-收到
        ctAuditStatus: null, //合同审核状态：0-待审核，1-审核通过，2-审核驳回
        ctProxyStatus: null, // 委托个人签合同协议状态：0-需要，1-不需要，2-有效，3-无效
        ctProxyFile: null // 委托个人签合同协议id，null表示没有上传
      }
    }
  },
  methods: {
    goToPage(url) {
      uni.navigateTo({
        url: url
      })
    },
    getUserUpgradeApplyInfo () {
      getUserUpgradeApplyApi({}, res => {
        if (res.status == 0) {
          this.applyInfo = res.data;
          // 营业执照 applyInfo.bizLicense && applyInfo.bizLicenseStatus == 1
          // 委托个人打款协议 (applyInfo.tfProxyFile && applyInfo.tfProxyStatus == 2 && applyInfo.tfStatus == 1) || applyInfo.tfProxyStatus == 1
          // !applyInfo.ctId || 
          // 委托个人签署合同协议 applyInfo.ctId && (applyInfo.ctProxyStatus == 1 || (applyInfo.ctProxyStatus == 2 && applyInfo.ctProxyFile))
          // 合同 applyInfo.ctId && applyInfo.ctStatus == 1 && applyInfo.ctAuditStatus == 1
          // if ((this.applyInfo.bizLicense && this.applyInfo.bizLicenseStatus == 1)
          // && ((this.applyInfo.tfProxyFile && this.applyInfo.tfProxyStatus == 2 && this.applyInfo.tfStatus == 1) || this.applyInfo.tfProxyStatus == 1)
          // && (!this.applyInfo.ctId || (this.applyInfo.ctId && (this.applyInfo.ctProxyStatus == 1 || (this.applyInfo.ctProxyStatus == 2 && this.applyInfo.ctProxyFile)) && this.applyInfo.ctStatus == 1 && this.applyInfo.ctAuditStatus == 1))) {
          //   // 
          // } else {
          //   // this.modal.show = true;
          //   // this.modal.maskClick = false;
          // }
        }
      }, null, {showErrorMsg: true});
    },
  },
  onShow() {
    this.getUserUpgradeApplyInfo();
  }
}
</script>

<style lang="scss" scoped>
  .contentDiv {
    width: 100%;
    height: 87rpx;
    background: #FFF;
  }
  .content{
    width: 717rpx;
    height: 87rpx;
    margin-left:31rpx;
    border-bottom:2rpx solid #E1E1E1;
    line-height: 87rpx;
    position:relative;
  }
  .clearLine{
    border:none;
  }
  .content text{
    font-size:28rpx;
    font-family:PingFang SC;
    font-weight:500;
    color:rgba(51,51,51,1);
  }
  .choice_btn_font{
    font-size:12px;
    font-family:PingFang SC;
    font-weight:500;
    color:rgba(153,153,153,1);
    position:absolute;
    top:0;
    right:65rpx;
  }
  /* 三角形 */
  .arrow {
    position:absolute;
    right:33rpx;
    top:32rpx;
    border-right: 3rpx solid #8A8A8A;
    border-top: 3rpx solid #8A8A8A;
    height: 18rpx;
    width: 18rpx;
    transform: rotate(45deg);
    -webkit-transform: rotate(45deg);
    /*不加这两个属性三角会比上一个略丑, 大家可以试一下*/
    border-left: 2rpx solid transparent;
    border-bottom: 2rpx solid transparent;
  }
  .tips{
    float: right;
    margin:31rpx;
    font-size:24rpx;
    font-family:PingFang SC;
    font-weight:500;
    color:rgba(153,153,153,1);
  }
  
  .complete {
    color: #C2AC78;
  }
 
</style>
